
package org.bridgen.lang.semantics.ast;
import java.util.*;


public class SGLRReefDecl extends ConcreteReefDecl implements Cloneable {
    public void flushCache() {
        super.flushCache();
    }
     @SuppressWarnings({"unchecked", "cast"})  public SGLRReefDecl clone() throws CloneNotSupportedException {
        SGLRReefDecl node = (SGLRReefDecl)super.clone();
        node.in$Circle(false);
        node.is$Final(false);
    return node;
    }
     @SuppressWarnings({"unchecked", "cast"})  public SGLRReefDecl copy() {
      try {
          SGLRReefDecl node = (SGLRReefDecl)clone();
          if(children != null) node.children = (ASTNode[])children.clone();
          return node;
      } catch (CloneNotSupportedException e) {
      }
      System.err.println("Error: Could not clone node of type " + getClass().getName() + "!");
      return null;
    }
     @SuppressWarnings({"unchecked", "cast"})  public SGLRReefDecl fullCopy() {
        SGLRReefDecl res = (SGLRReefDecl)copy();
        for(int i = 0; i < getNumChildNoTransform(); i++) {
          ASTNode node = getChildNoTransform(i);
          if(node != null) node = node.fullCopy();
          res.setChild(node, i);
        }
        return res;
    }
    // Declared in PrettyPrint.jrag at line 113

    
    public void pp(StringBuffer buf) {
    	buf.append(indent() + "reef " + getName());
    	if (hasSuperNode()) {
    		buf.append(" : ");
    		getSuperNode().pp(buf);
    	} 
    	buf.append(" = ");
    	for (int i = 0; i < getNumMatchPattern(); i++) {
    		getMatchPattern(i).pp(buf);
    		if (i != getNumMatchPattern()-1) {
    			buf.append(" ");
    		}
    	}
    	buf.append(" for-sglr");
    	getAltPattern().pp(buf);
    	buf.append(";\n");
    }

    // Declared in TypeCodeGen.jrag at line 227


	public void generateClassAttributes(String indent, StringBuffer buf) {
		super.generateClassAttributes(indent, buf);
	
		buf.append(indent + "public static final String[] TOKEN = {\n");
		getAltPattern().generateClassAttributes(indent + INDENT, buf);
		buf.append(indent + "};\n");
		buf.append(indent + "private int tokenNbr = 0;\n");
		buf.append(indent + "public void setTokenUse(int nbr) {\n");
		buf.append(indent + INDENT + "tokenNbr = nbr;\n");
		buf.append(indent + "}\n\n");
	}

    // Declared in bridgit.ast at line 3
    // Declared in bridgit.ast line 31

    public SGLRReefDecl() {
        super();

        setChild(new Opt(), 0);
        setChild(new List(), 1);

    }

    // Declared in bridgit.ast at line 12


    // Declared in bridgit.ast line 31
    public SGLRReefDecl(String p0, Opt<NodeUse> p1, List<MatchPattern> p2, AltPattern p3) {
        setName(p0);
        setChild(p1, 0);
        setChild(p2, 1);
        setChild(p3, 2);
    }

    // Declared in bridgit.ast at line 19


  protected int numChildren() {
    return 3;
  }

    // Declared in bridgit.ast at line 22

  public boolean mayHaveRewrite() { return false; }

    // Declared in bridgit.ast at line 2
    // Declared in bridgit.ast line 20
    public void setName(String value) {
        tokenString_Name = value;
    }

    // Declared in bridgit.ast at line 5

    public String getName() {
        return tokenString_Name != null ? tokenString_Name : "";
    }

    // Declared in bridgit.ast at line 2
    // Declared in bridgit.ast line 20
    public void setSuperNodeOpt(Opt<NodeUse> opt) {
        setChild(opt, 0);
    }

    // Declared in bridgit.ast at line 6


    public boolean hasSuperNode() {
        return getSuperNodeOpt().getNumChild() != 0;
    }

    // Declared in bridgit.ast at line 10


     @SuppressWarnings({"unchecked", "cast"})  public NodeUse getSuperNode() {
        return (NodeUse)getSuperNodeOpt().getChild(0);
    }

    // Declared in bridgit.ast at line 14


    public void setSuperNode(NodeUse node) {
        getSuperNodeOpt().setChild(node, 0);
    }

    // Declared in bridgit.ast at line 17

     @SuppressWarnings({"unchecked", "cast"})  public Opt<NodeUse> getSuperNodeOpt() {
        return (Opt<NodeUse>)getChild(0);
    }

    // Declared in bridgit.ast at line 21


     @SuppressWarnings({"unchecked", "cast"})  public Opt<NodeUse> getSuperNodeOptNoTransform() {
        return (Opt<NodeUse>)getChildNoTransform(0);
    }

    // Declared in bridgit.ast at line 2
    // Declared in bridgit.ast line 30
    public void setMatchPatternList(List<MatchPattern> list) {
        setChild(list, 1);
    }

    // Declared in bridgit.ast at line 6


    private int getNumMatchPattern = 0;

    // Declared in bridgit.ast at line 7

    public int getNumMatchPattern() {
        return getMatchPatternList().getNumChild();
    }

    // Declared in bridgit.ast at line 11


     @SuppressWarnings({"unchecked", "cast"})  public MatchPattern getMatchPattern(int i) {
        return (MatchPattern)getMatchPatternList().getChild(i);
    }

    // Declared in bridgit.ast at line 15


    public void addMatchPattern(MatchPattern node) {
        List<MatchPattern> list = getMatchPatternList();
        list.addChild(node);
    }

    // Declared in bridgit.ast at line 20


    public void setMatchPattern(MatchPattern node, int i) {
        List<MatchPattern> list = getMatchPatternList();
        list.setChild(node, i);
    }

    // Declared in bridgit.ast at line 24

    public List<MatchPattern> getMatchPatterns() {
        return getMatchPatternList();
    }

    // Declared in bridgit.ast at line 27

    public List<MatchPattern> getMatchPatternsNoTransform() {
        return getMatchPatternListNoTransform();
    }

    // Declared in bridgit.ast at line 31


     @SuppressWarnings({"unchecked", "cast"})  public List<MatchPattern> getMatchPatternList() {
        return (List<MatchPattern>)getChild(1);
    }

    // Declared in bridgit.ast at line 35


     @SuppressWarnings({"unchecked", "cast"})  public List<MatchPattern> getMatchPatternListNoTransform() {
        return (List<MatchPattern>)getChildNoTransform(1);
    }

    // Declared in bridgit.ast at line 2
    // Declared in bridgit.ast line 31
    public void setAltPattern(AltPattern node) {
        setChild(node, 2);
    }

    // Declared in bridgit.ast at line 5

    public AltPattern getAltPattern() {
        return (AltPattern)getChild(2);
    }

    // Declared in bridgit.ast at line 9


    public AltPattern getAltPatternNoTransform() {
        return (AltPattern)getChildNoTransform(2);
    }

    // Declared in Compilation.jrag at line 62
 @SuppressWarnings({"unchecked", "cast"})     public boolean isForSGLR() {
        boolean isForSGLR_value = isForSGLR_compute();
        return isForSGLR_value;
    }

    private boolean isForSGLR_compute() {  return true;  }

    // Declared in TypeCodeGen.jrag at line 252
 @SuppressWarnings({"unchecked", "cast"})     public boolean forSGLR() {
        boolean forSGLR_value = forSGLR_compute();
        return forSGLR_value;
    }

    private boolean forSGLR_compute() {  return true;  }

public ASTNode rewriteTo() {
    return super.rewriteTo();
}

}
